package cn.study.luckyapp.acceptPrize.command;

import cn.study.luckyapp.assembler.AcceptPrizeAssembler;
import cn.study.luckyclient.dto.AcceptPrizeAddCmd;
import cn.study.luckyclient.dto.data.AcceptPrizeVo;
import cn.study.luckydomain.acceptPrize.AcceptPrizeEntity;
import cn.study.luckydomain.gateway.IAcceptPrizeGateWay;
import lombok.AllArgsConstructor;
import org.bouncycastle.cms.PasswordRecipientId;
import org.springframework.stereotype.Component;

@Component
@AllArgsConstructor
public class AcceptPrizeCmdExe {
    private final IAcceptPrizeGateWay acceptPrizeGateWay;
    public AcceptPrizeVo execute(AcceptPrizeAddCmd cmd){
        AcceptPrizeEntity acceptPrizeEntity = AcceptPrizeAssembler.toEntity(cmd);
        AcceptPrizeEntity add = acceptPrizeGateWay.add(acceptPrizeEntity);
        return AcceptPrizeAssembler.toAcceptPrizeVO(add);
    }
}
